﻿using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;

namespace KyuuBackground
{
    #region Adornment Factory
    [Export(typeof(IWpfTextViewCreationListener))]
    [ContentType("text")]
    [TextViewRole(PredefinedTextViewRoles.Document)] // for Visual Studio 2013+
    internal sealed class KyuuBackgroundFactory : IWpfTextViewCreationListener
    {
        internal const string AdornmentLayerName = "KyuuBackground";

        [Export(typeof(AdornmentLayerDefinition))]
        [Name(AdornmentLayerName)]
        [Order(Before = PredefinedAdornmentLayers.Outlining)] // so the layer is below Outlining
        public AdornmentLayerDefinition EditorAdornmentLayer = null;

        public void TextViewCreated(IWpfTextView textView)
        {
            new KyuuBackground(textView);
        }
    }
    #endregion
}
